package com.tankgame;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: FENGYiMing
 * @Date: 2024/04/15/14:40
 * @Description:
 */
public class Recoder {
    private static int allEnemyTankNum = 0;

    public static void setAllEnemyTankNum(int allEnemyTankNum) {
        Recoder.allEnemyTankNum = allEnemyTankNum;
    }

    public static int getAllEnemyTankNum() {
        return allEnemyTankNum;
    }

    public static void addAllEnemyTankNum() {
        Recoder.allEnemyTankNum++;
    }

    public static void keepRecord() {
        BufferedWriter bufferedWriter = null;
        try {
            bufferedWriter = new BufferedWriter(new FileWriter("e:/TankKillNum.txt"));
            bufferedWriter.write(allEnemyTankNum + "\n");

        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                bufferedWriter.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
